package iot.core.data.mapper;

import iot.core.data.entity.HTRole;
import iot.core.data.entity.HTRoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface HTRoleMenuMapper extends MyBaseMapper<HTRoleMenu> {


    @Select( value = {" <script> " +
            "select d.Urls \n" +
            "from htrolemenu  a\n" +
            "inner join htmenu b on a.HTRole_Id in " +
            "<foreach item=\"item\" index=\"index\" collection=\"lst\" open=\"(\" separator=\",\" close=\")\">  \n" +
            "     #{item}\n" +
            "    </foreach>  "+
            "and  a.HTMenu_Id =b.Id  and b.Deleted =0\n" +
            "inner join htpage c on b.HTPage_Id =c.Id  and c.Deleted =0\n" +
            "inner join htpageauth d on c.id=d.HTPage_Id and d.Deleted =0" +

            " </script>"})
    List<String> getRolesMenu(List<Long> lst);



    @Select( value = {" <script> " +
            "select b.Id \n" +
            "from htrolemenu  a\n" +
            "inner join htmenu b on a.HTRole_Id in " +
            "<foreach item=\"item\" index=\"index\" collection=\"lst\" open=\"(\" separator=\",\" close=\")\">  \n" +
            "     #{item}\n" +
            "    </foreach>  "+
            "and  a.HTMenu_Id =b.Id  and b.Deleted =0\n" +

            " </script>"})
    List<Long> getRolesMenuIds(List<Long> lst);
}

